import {createWebHashHistory, createRouter} from "vue-router";

import Login from '@/views/Login.vue';
import AdminHome from "@/views/admin/adminHome.vue";
import TeachersHome from "@/views/teachers/teachersHome.vue";
import StudentsHome from "@/views/students/studentsHome.vue";

import SPersonalCenter from "@/views/students/S-personal-center.vue";
import TPersonalCenter from "@/views/teachers/T-personal-center.vue";

import ClassManagement from "@/views/admin/class-management.vue";
import CourseManagement from "@/views/admin/course-management.vue";
import StudentsManagement from "@/views/admin/students-management.vue";
import TeachersManagement from "@/views/admin/teachers-management.vue";

import SHomeworkManagement from "@/views/students/homework-management.vue";
import SCourseManagement from "@/views/students/course-management.vue";
import Announcements from "@/views/students/announcements.vue";

import HomeworkManagement from "@/views/teachers/homework-management.vue";
import GradingManagement from "@/views/teachers/grading-management.vue";
import ClassAnnouncements from "@/views/teachers/class-announcements.vue";
import TCourseManagement from "@/views/teachers/course-management.vue";

const routers=[
    {
        path:'/',
        name:'Login',
        component:Login,//登录界面
    },
    {
        path: '/admin',
        name:'Admin',
        component:AdminHome,//管理员首页
        children:[
            {
                path:'',
                redirect:'classManagement'
            },
            {
                path: '/classManagement',
                name:'ClassManagement',
                component:ClassManagement//班级管理页面
            },
            {
                path: '/courseManagement',
                name:'CourseManagement',
                component:CourseManagement//课程管理页面
            },
            {
                path: '/studentManagement',
                name:'StudentsManagement',
                component:StudentsManagement//学生管理页面
            },
            {
                path: '/teacherManagement',
                name:'TeachersManagement',
                component:TeachersManagement//教师管理页面
            }

        ]
    },
    {
        path: '/teachers',
        name:'Teachers',
        component:TeachersHome,//教师首页
        children:[
            {
                path:'',
                redirect:'tPersonalCenter'//教师个人中心
            },
            {
                path:'/tPersonalCenter',
                name:'TPersonalCenter',
                component:TPersonalCenter
            },
            {
                path: '/homeworkManagement',
                name:'HomeworkManagement',
                component:HomeworkManagement//作业发布与管理界面
            },
            {
                path: '/gradingManagement',
                name:'GradingManagement',
                component:GradingManagement//批改界面
            },
            {
                path: '/classAnnouncements',
                name:'ClassAnnouncements',
                component:ClassAnnouncements//班级公告界面
            },
            {
                path: '/tCourseManagement',
                name:'TCourseManagement',
                component:TCourseManagement//课程管理
            }
        ]
    },
    {
        path: '/students',
        name:'Students',
        component:StudentsHome,//学生首页
        children:[
            {
                path:'',
                redirect:'sPersonalCenter'//学生个人中心
            },
            {
                path: '/sPersonalCenter',
                name:'SPersonalCenter',
                component:SPersonalCenter
            },
            {
                path: '/sCourseManagement',
                name:'SCourseManagement',
                component:SCourseManagement
            },
            {
                path: '/sHomeworkManagement',
                name:'SHomeworkManagement',
                component:SHomeworkManagement
            },
            {
                path: '/announcements',
                name: 'Announcements',
                component:Announcements//公告查看界面
            }
        ]
    }
]

const router=createRouter({
    history:createWebHashHistory(),
    routes:routers
})

export default router;